package com.jake.rabbit.sap.service;

import com.jake.rabbit.util.ThreadUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

@Service
public class AttendanceService {

    public Map<String, Object> attendanceByArea(String area) {
        ThreadUtils.sleep(100);
        Map<String, Object> attendance = new HashMap<>(4);
        Set<String> blocks = new HashSet<>();
        if (StringUtils.equals(area, "南山")) {
            blocks.add("深圳湾");
            blocks.add("蛇口");
            blocks.add("前海");
            blocks.add("西丽");
        } else if (StringUtils.equals(area, "宝安")) {
            blocks.add("宝安中心");
            blocks.add("新安");
            blocks.add("西乡");
            blocks.add("碧海");
        } else if (StringUtils.equals(area, "福田")) {
            blocks.add("香蜜湖");
            blocks.add("石厦");
            blocks.add("保税区");
            blocks.add("梅林");
        } else {
            return null;
        }
        attendance.put(area, blocks);
        return attendance;
    }

    public Map<String, Object> attendanceByDate(int year) {
        ThreadUtils.sleep(100);
        Map<String, Object> attendance = new HashMap<>(4);
        double value;
        switch (year) {
            case 2017:
                value = 70000;
                break;
            case 2018:
                value = 80000;
                break;
            case 2019:
                value = 90000;
                break;
            default:
                return null;
        }
        attendance.put(Integer.toString(year), value);
        return attendance;
    }

}
